package m.jclecai.com.ui;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import m.jclecai.com.R;
import m.jclecai.com.base.digitalLottery.BaseNumberLotteryActivity;
import m.jclecai.com.bean.BallItem;
import m.jclecai.com.bean.LotteryNumberMenuBean;
import m.jclecai.com.utils.MakeRandomUtil;

/**
 * Created by zed on 2018/3/19.
 * 北京PK10
 */

public class BjPk10Activity extends BaseNumberLotteryActivity {

    @Override
    protected int getContentRes() {
        return R.layout.activity_bjpk10;
    }

    @Override
    protected void initView() {
        super.initView();
        mType = "pk10";
        setTitle("北京pk10", R.drawable.gs);
        rightOptionText("", R.drawable.action_menu);
        leftOptionText("");
    }

    @Override
    protected boolean allowBallDuplicate() {
        if (currentMenu != null) {
            if (currentMenu.getMenuId() > 3) {
                //从猜前5名之后的结果都是每行只能选择一个球 且不能重复
                return false;
            }
        }
        return super.allowBallDuplicate();
    }

    @Override
    public int setUpCustomAlgorithm() {
        if (currentMenu != null && currentMenu.getSelectBall() != null && currentMenu.getSelectBall().size() > 0) {
            Map<Integer, Map<Integer, BallItem>> selectBall = currentMenu.getSelectBall();
            switch (currentMenu.getMenuId()) {
                case 1:
                    return MakeRandomUtil.getBallPk10Two(selectBall.get(0), selectBall.get(1));
                case 2:
                    return MakeRandomUtil.getBallPk10Three(selectBall.get(0), selectBall.get(1), selectBall.get(2));
                case 3:
                    return MakeRandomUtil.getBallPk10Four(selectBall.get(0), selectBall.get(1), selectBall.get(2), selectBall.get(3));
            }
        }
        return super.setUpCustomAlgorithm();
    }

    /**
     * 初始化bjpk10的弹出菜单参数
     **/
    @Override
    public List<LotteryNumberMenuBean> initMenuData() {
        return new ArrayList<LotteryNumberMenuBean>() {{
            add(new LotteryNumberMenuBean(0, "猜冠军", 1, 10, false, 1));
            add(new LotteryNumberMenuBean(1, "猜冠亚军", 2, 10, false, 2));
            add(new LotteryNumberMenuBean(2, "猜前三名", 3, 10, false, 3));
            add(new LotteryNumberMenuBean(3, "猜前四名", 4, 10, false, 4));
            add(new LotteryNumberMenuBean(4, "猜前五名", 5, 10, false, 5));
            add(new LotteryNumberMenuBean(5, "猜前六名", 6, 10, false, 6));
            add(new LotteryNumberMenuBean(6, "猜前七名", 7, 10, false, 7));
            add(new LotteryNumberMenuBean(7, "猜前八名", 8, 10, false, 8));
            add(new LotteryNumberMenuBean(8, "猜前九名", 9, 10, false, 9));
            add(new LotteryNumberMenuBean(9, "猜前十名", 10, 10, false, 10));
        }};
    }

}
